#!/usr/bin/env python

import pygame, pygamesvg, sys
from pygame.locals import *

if len(sys.argv) < 2:
    print "Display an SVG image.\nUsage: %s svgfile" % sys.argv[0]
    sys.exit(1)
screen = pygame.display.set_mode((600, 600))
screen.fill((0, 0, 255))
surface = pygame.Surface((600, 600), SRCALPHA, 32)
surface.fill((255, 0, 0, 255))



doc = file(sys.argv[1]).read()

surf = pygamesvg.fileToSurface(file(sys.argv[1]), scale=(0.5, 0.5), alpha=0.8)

r = surf.get_rect()
print r.w, r.h

surface.blit(surf, (0, 0))

#surface.convert()
#surface.convert_alpha()

screen.blit(surface, (0, 0))
while True:
    for event in pygame.event.get():
      if event.type == pygame.QUIT: sys.exit()
    pygame.display.update()
    pygame.time.wait(100)

